package com.servlet.service;

import java.sql.SQLException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.servlet.dao.PaymentDao;
import com.servlet.vo.Payment;

public class PaymentService {

	private boolean flag = false;
	
	public boolean add(HttpServletRequest req) throws SQLException{
		
		Payment obj = new Payment();
		obj.setPaymentName(req.getParameter("paymentName"));
		
		flag = new PaymentDao().save(obj);
		
		return flag;
	}
	
	public boolean del(HttpServletRequest req) throws SQLException{
		
		String objId = req.getParameter("objId");
		if(null != objId && !"".equals(objId)){

			flag = new PaymentDao().delete(Long.parseLong(objId));
		}
		
		return flag;
	}
	
	public List<Payment> getList(HttpServletRequest req) throws SQLException{
	
		List<Payment> objs = new PaymentDao().getList();
		
		return objs;
	}
	
}
